/* Basic Reset & Body Styling */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4; /* Light background for contrast */
    line-height: 1.6;
}

h1 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.2rem;
}

.instructions {
    text-align: center;
    margin-bottom: 2rem;
    font-weight: bold;
    text-decoration: underline;
}

.instructions2 {
    font-style: italic;
    font-weight: bold;
    line-height: 1.2;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.underline {
    text-decoration: underline;
}

/* Page Container - Mobile First (Single Column) */
.page-container {
    display: grid;
    grid-template-columns: 1fr; /* Single column by default */
    gap: 1rem; /* Gap between rows on mobile */
    padding: 1rem; /* Padding around the whole container */
    max-width: 1200px; /* Max width for very large screens */
    margin: 0 auto; /* Center the container */
}

/* Hide Sidebars by Default (Mobile First) */
.sidebar {
    display: none;
    background-color: #e9e9e9; /* Sidebar background */
    padding: 1rem;
    border-radius: 5px;
    text-align: center;
}

/* Content Area - Adjusted padding for fixed score display */
.content-area {
    background-color: #ffffff;
    padding: 1.5rem;
    /* Add sufficient top padding to clear the fixed score display */
    padding-top: calc(0.6rem + 7px + 2px); /* (existing padding) + (score height) + (top offset) */
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Score Display (Fixed, Circular, and Styled as Stacked Fraction) */
.score-display {
    position: fixed; /* Make it stay in place */
    top: 20px; /* Distance from the top */
    right: 20px; /* Distance from the right */
    z-index: 1000; /* Ensure it's above other content */

    /* Circular Styling */
    width: 70px; /* Diameter of the circle */
    height: 70px; /* Diameter of the circle */
    border-radius: 50%; /* Make it circular */
    background-color: #007bff; /* Example background color (blue) - Change as desired */
    color: white; /* Text color */
    display: flex;
    flex-direction: column; /* Stack children vertically */
    justify-content: center; /* Center content vertically */
    align-items: center; /* Center content horizontally */
    font-size: 1.1em;
    font-weight: bold;
    border: 3px solid #fff; /* Optional white border */
    box-shadow: 0 4px 8px rgba(0,0,0,0.3); /* Optional shadow */
    box-sizing: border-box; /* Include border and padding in width/height */
    padding: 5px; /* Padding inside the circle */
}

/* Style for the current score number */
.score-display #current-score {
    display: block; /* Ensure block for stacking */
    text-align: center;
    line-height: 1; /* Reset line height for single number */
    margin: 0; /* Remove default margins */
    padding: 0; /* Remove default padding */
}

/* Style for the fraction line (New) */
.score-display .fraction-line {
    display: block; /* Ensure block for stacking */
    width: 80%; /* Width of the line */
    height: 1px; /* Thickness of the line */
    background-color: rgba(255, 255, 255, 0.7); /* White line, slightly transparent */
    margin: 2px auto; /* Vertically space and center the line */
    padding: 0;
}

/* Style for the total questions number */
.score-display #total-questions {
    display: block; /* Ensure block for stacking */
    text-align: center;
    line-height: 1; /* Reset line height for single number */
    margin: 0; /* Remove default margins */
    padding: 0; /* Remove default padding */
}


/* Question Block Styling */
.question-block {
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
}

.question-block:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.question-number {
    font-weight: bold;
    margin-right: 0.5em;
}

.question-text {
    font-size: 1.1em;
    margin-bottom: 1.5rem;
}

/* --- Options Layout --- */
.options-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.option {
    display: flex; /* Align radio button, label, and icon */
    align-items: center;
}

.option input[type="radio"] {
    margin-right: 0.75em; /* Space between radio and label */
    accent-color: #007bff;
    transform: scale(1.1);
    cursor: pointer;
    flex-shrink: 0; /* Prevent radio from shrinking */
}

/* Adjusted margin for label to be closer to icon */
.option label {
    cursor: pointer;
    flex-grow: 1; /* Allow label to take available space */
    margin-right: 5px; /* Small space between label end and icon start */
    padding-right: 0;
    word-break: break-word; /* Prevent long text from pushing icon too far */
}

/* Feedback Icon (Adjusted margin to be closer to label) */
.option .feedback-icon {
    margin-left: 0; /* Remove left margin, spacing controlled by label's right margin */
    margin-right: 0; /* No space after the icon */
    font-weight: bold;
    font-size: 1.2em;
    visibility: hidden;
    width: 1em; /* Give it a fixed width to reserve space */
    text-align: center;
    flex-shrink: 0; /* Prevent icon from shrinking */
}

.option .feedback-icon.correct {
    color: green;
    visibility: visible;
}

.option .feedback-icon.wrong {
    color: red;
    visibility: visible;
}

/* Style to highlight the correct answer when wrong is selected */
.question-block.answered .option.is-correct label {
    color: green;
    font-weight: bold;
}

/* Style for disabled radio buttons and labels after answering */
.question-block.answered input[type="radio"] {
    cursor: default;
    pointer-events: none; /* Prevent clicking */
}

.question-block.answered .option label {
     cursor: default; /* Change label cursor as well */
}


/* Container for buttons */
.button-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}


/* Mark Button */
.mark-button {
    display: inline-block;
    background-color: #007bff;
    color: white;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.2s ease;
    box-shadow: 3px 3px 3px 3px rgb(236, 236, 236);
}

.mark-button:hover {
    background-color: #0056b3;
}

/* Style for disabled Mark button */
.mark-button:disabled {
    opacity: 0.6;
    cursor: default;
    box-shadow: none;
}


/* Solution Button */
.solution-button {
    display: inline-block;
    background-color: #4CAF50; /* Green background */
    color: white;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.2s ease;
    box-shadow: 3px 3px 3px 3px rgb(236, 236, 236);
}

.solution-button:hover {
    background-color: #388E3C; /* Darker green on hover */
}

/* Solution Explanation */
.solution-explanation {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: #e9f7ef; /* Light green background */
    border: 1px solid #c8e6c9; /* Green border */
    border-radius: 5px;
    display: none; /* Initially hidden */
    color: #333; /* Text color */
    font-size: 0.95em;
}

.solution-explanation p {
    margin: 0; /* Remove default paragraph margin */
}


/* Placeholder for Ads */
.ad-placeholder {
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    border: 1px dashed #ccc;
}

/* --- Responsive Adjustments for Tablet and Desktop --- */
@media (min-width: 768px) {
    .page-container {
        grid-template-columns: 1fr 3fr 1fr;
        gap: 1.5rem;
        padding: 1.5rem;
    }

    .sidebar {
        display: block;
    }

    .content-area {
        padding: 2rem;
        padding-top: calc(2rem + 70px + 20px); /* Adjusted padding */
    }

    .options-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
        gap: 1rem;
    }
}

/* Further adjustments for very large screens if needed */
@media (min-width: 1024px) {
    .page-container {
        grid-template-columns: 250px auto 250px;
    }

    h1 {
        text-align: center;
        margin-bottom: 2rem;
        font-size: 1.5rem;
    }

    /* Content Area - Adjusted padding for fixed score display */
.content-area {
    background-color: #ffffff;
    padding: 1.5rem;
    /* Add sufficient top padding to clear the fixed score display */
    padding-top: calc(0.6rem + 7px + 2px); /* (existing padding) + (score height) + (top offset) */
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
}